<?php
/**
 * Modify Setting Procedure
 *
 * @author University of London Computer Centre
 * @version 1.1.0
 * @package ArchivePress
 * @subpackage pages
 * @global ArchivePress $ArchivePress
 */

// globals
global $ArchivePress;

// actions URL
$responder = get_bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=archivepress/pages/responder.php&amp;back=add-feed';

// get info to apply the filters
// STATUS (only ALL)
$status = "all";


// SEARCH FIELD
$search = "";
if(isset($_GET["s"])){
    $search = $_GET["s"];
}

// BLOGS LIST
$parentblog = "";
if(isset($_GET["parentblog"])){
    $parentblog = attribute_escape($_GET["parentblog"]);
    if($parentblog == "ALL"){
        $parentblog = "";
    }
}
$optionBlogs = "";
$blogs = $ArchivePress->getFeeds(false, false);
foreach($blogs as $blog) {
    $optionBlogs .= '<option value="'.$blog["id"].'"'; if($blog["id"] == $parentblog) $optionBlogs .= ' selected="selected"'; $optionBlogs .='>'.$ArchivePress->cleanOutput($blog["name"]).'</option>';
}


// CHECK FOR MESSAGES
$message = "";
// delete
if(array_key_exists("deletelog", $_GET)){
    if((int)$_GET["deletelog"] == 1){
        // SINGLE ACTION
        $message = __("1 Log Deleted", ARCHIVEPRESS);
    } else {
        // BULK ACTIONS
        $message = sprintf(__("%d Logs Deleted",ARCHIVEPRESS), (int)$_GET["deletelog"]);
    }
}

// logon
if(array_key_exists("logon", $_GET)){
    $message = __("ArchivePress Log System ON", ARCHIVEPRESS);
}

// logoff
if(array_key_exists("logoff", $_GET)){
    $message = __("ArchivePress Log System OFF", ARCHIVEPRESS);
}

// logempty
if(array_key_exists("logempty", $_GET)){
    $message = __("All the logs have been deleted from the database", ARCHIVEPRESS);
}

$message = "Coming Soon...";
if($message != ""){
    $message = '<div class="updated fade below-h2" id="message">
                    <p>
                        '.$message.'<br />
                    </p>
                </div>';
}



echo '<div class="wrap">
        <div class="icon32" id="icon-archivepress"><br /></div>
        <h2>'.__("ArchivePress Settings", ARCHIVEPRESS).'</h2>
        '.$message.'
      </div>';

?>